package pack0703;

import java.util.Scanner;

public class DemoA {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入一个字符串: ");
        String s=scan.nextLine();

        //定义几个变量代表相应的个数
        int ucount=0;
        int lcount=0;
        int dcount=0;
        int scount=0;
        int lettercount=0;
        int ocount=0;

        //依次循环判断每个字符,从字符串中获取到每个字符判断
        for(int i=0;i<s.length();i++){
            if(Character.isUpperCase(s.charAt(i))){
                ucount++;
                lettercount++;
            }else if(Character.isLetter(s.charAt(i))){
                lcount++;
                lettercount++;
            }else if(Character.isDigit(s.charAt(i))){
                dcount++;
            }else if(Character.isWhitespace(s.charAt(i))){
                scount++;
            }else{
                ocount++;
            }

        }
        System.out.println("大写的个数"+ucount);
        System.out.println("小写的个数"+lcount);
        System.out.println("字母的个数"+lettercount);
        System.out.println("数字的个数"+dcount);
        System.out.println("空格的个数"+scount);
        System.out.println("其他的个数"+ocount);
    }
}
